package Controllers;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import Impl.OrderServiceImpl;

/**
 * Servlet implementation class OrderDeleteController
 */
@Controller
public class OrderDeleteController extends HttpServlet {
	private static final long serialVersionUID = 1L;
	OrderServiceImpl orderService;
   @RequestMapping("/OrderDelete")
   protected void handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
	    ApplicationContext applicationContext=(ApplicationContext)request.getSession().getServletContext().getAttribute("ctx");
		orderService=(OrderServiceImpl)applicationContext.getBean("OrderServiceImpl");
		int orderid=Integer.parseInt(request.getParameter("orderid"));
		orderService.deleteOrder(orderid);
   }

}
